package cn.wh.mybatis.session.defaults;

import cn.wh.mybatis.binding.MapperRegistry;
import cn.wh.mybatis.session.SqlSession;
import cn.wh.mybatis.session.SqlSessionFactory;

/**
 * @Description 工厂
 * @Version 1.0.0
 * @Date 2022/11/29 16:54
 * @Created wh
 */
public class DefaultSqlSessionFactory  implements SqlSessionFactory {

    private final MapperRegistry mapperRegistry;

    public DefaultSqlSessionFactory(MapperRegistry mapperRegistry) {
        this.mapperRegistry = mapperRegistry;
    }

    @Override
    public SqlSession openSession() {
        return new DefaultSqlSession(mapperRegistry);
    }
}
